package com.example.leonard.core.mq.provider;

import com.example.leonard.core.mq.mqconfig.MQConstants;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DirectProvider {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendMessage() {
        String context = "send directMessage";
        rabbitTemplate.convertAndSend(MQConstants.DIRECTEXCHANGE, MQConstants.DIRECT_ROUTING_KEYS, context);
        rabbitTemplate.convertAndSend(MQConstants.DIRECTEXCHANGE, MQConstants.DIRECT_ROUTING_KEY, context);
    }
}
